package com.nondo.rdp.finance.domain.course;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;

/**
 * 求知-课程-课节-音视频播放进度
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "section_process")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class SectionProcess extends BaseEntity {
	private static final long serialVersionUID = -688980575024697800L;
	private Long id; // 主键
	private Section section; // 课节
	private User User; // 播放用户
	private String duration;// 总时长
	private String timePoint; // 当前时间点
	private Integer playState; // 播放状态  0未播放过|1播放完成|2正在播放
	
	//冗余字段
	private Long courseId; // 课程ID
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@OneToOne
	@JoinColumn(name="sid")
	public Section getSection() {
		return section;
	}

	public void setSection(Section section) {
		this.section = section;
	}

	@OneToOne
	@JoinColumn(name="uid")
	public User getUser() {
		return User;
	}

	public void setUser(User user) {
		User = user;
	}

	public String getDuration() {
		return duration;
	}

	public void setDuration(String duration) {
		this.duration = duration;
	}

	public String getTimePoint() {
		return timePoint;
	}

	public void setTimePoint(String timePoint) {
		this.timePoint = timePoint;
	}

	@Column(columnDefinition = "int default 0", nullable = false)
	public Integer getPlayState() {
		return playState;
	}

	public void setPlayState(Integer playState) {
		this.playState = playState;
	}

	public Long getCourseId() {
		return courseId;
	}

	public void setCourseId(Long courseId) {
		this.courseId = courseId;
	}

}
